package fr.oz.view.profile.dragable.ui 
{
	import caurina.transitions.Tweener;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	/**
	 * ...
	 * @author Fazermokeur
	 */
	public class Aiguille extends Sprite
	{
		
		public var glowAiguille:Sprite;
		
		public function Aiguille() 
		{
			addEventListener(Event.ADDED_TO_STAGE, init);
			glowAiguille.alpha = 0;
		}
		
		private function init(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			addEventListener(Event.REMOVED_FROM_STAGE, dispose);
			buttonMode = true;
			mouseChildren = false;
			
			addEventListener(MouseEvent.MOUSE_DOWN, downHandler);
			//stage.addEventListener(MouseEvent.MOUSE_UP, upHandler);
		}
		
		private function dispose(e:Event):void 
		{
			removeEventListener(Event.REMOVED_FROM_STAGE, dispose);
			removeEventListener(MouseEvent.MOUSE_DOWN, downHandler);
			//stage.removeEventListener(MouseEvent.MOUSE_UP, upHandler);
		}
		
		public function upHandler():void 
		{
			Tweener.addTween(glowAiguille, { alpha:0, time:.5 } );
		}
		
		private function downHandler(e:MouseEvent):void 
		{
			glowAiguille.alpha = 1;
		}
		
	}

}